<!--
 * @Author: your name
 * @Date: 2021-08-06 20:47:13
 * @LastEditTime: 2021-08-06 21:04:46
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue_test\src\components\Test2.vue
-->
<template>
  <div>
    <button @click="isShow = !isShow">显示 | 隐藏</button>
    <transition name="hello" appear>
      <h1 v-show="isShow">你好啊</h1>
    </transition>
  </div>
</template>

<script>
export default {
  name: "Test2",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style scoped>
h1 {
  background: rgb(104, 97, 97);
  transition: 0.5s linear;
}
.hello-enter,
.hello-leave-to {
  transform: translateX(-100%);
}
.hello-enter-to,
.hello-leave {
  transform: translateX(0);
}

</style>